package tr.gov.tubitak.bilgem.esya.crlviewer;

import java.text.MessageFormat;
import java.util.ResourceBundle;

public class Bundle {
    private Bundle(){
        resourceBundle= ResourceBundle.getBundle("tr.gov.tubitak.bilgem.esya.crlviewer.lang");
    };
    private static Bundle instance=null;
    private ResourceBundle resourceBundle=null;

    public synchronized static Bundle getBundle() {
        if(instance == null)
        {
            instance = new Bundle();
        }
        return instance;
    }

    public String getStringLocal(String key) {
        try {
            String value = resourceBundle.getString(key);
            return value;
        } catch (Exception e) {
            return "?" + key + "?";
        }
    }

    public static String getString(String key) {
        return getBundle().getStringLocal(key);
    }

    public static String getString(String key, String... params){
        return MessageFormat.format(getString(key), params);
    }
}
